using System.Collections.Generic;

public class Table_UICfgItem : IDataItem
{
	/// <summary>
	/// 唯一ID
	/// <summary>
	public int Id { get; private set; }
	/// <summary>
	/// 资源路径
	/// <summary>
	public string Path { get; private set; }
	/// <summary>
	/// 界面类型
	/// <summary>
	public int UIType { get; private set; }
	/// <summary>
	/// 界面Panel数量
	/// <summary>
	public int PanelNum { get; private set; }
	/// <summary>
	/// 返回界面ID
	/// <summary>
	public int ReId { get; private set; }
	/// <summary>
	/// 关闭时是否销毁
	/// <summary>
	public bool Destroy { get; private set; }
	/// <summary>
	/// 切换场景时是否销毁
	/// <summary>
	public bool DestroyUnload { get; private set; }
	/// <summary>
	/// 是否可以通过导航栏返回按钮关闭界面 
	/// <summary>
	public bool IsBackClose { get; private set; }
	/// <summary>
	/// 镜头动画ID
	/// <summary>
	public int CameraMovieId { get; private set; }
	/// <summary>
	/// 界面层级
	/// <summary>
	public int Layer { get; private set; }
	/// <summary>
	/// 背景开关
	/// <summary>
	public int IsShowBg { get; private set; }
	/// <summary>
	/// 背景图片名称
	/// <summary>
	public string SceneBgName { get; private set; }
	/// <summary>
	/// 锁屏遮罩类型
	/// <summary>
	public int LockType { get; private set; }
	/// <summary>
	/// 是否显示3D相机
	/// <summary>
	public int Show3D { get; private set; }
	/// <summary>
	/// 功能开启新手指引ID
	/// <summary>
	public int OpenGuideId { get; private set; }
	/// <summary>
	/// 错误码ID
	/// <summary>
	public int ErrorId { get; private set; }
	/// <summary>
	/// 功能开关ID
	/// <summary>
	public int FuncSwitchId { get; private set; }
	/// <summary>
	/// 是否播放动画
	/// <summary>
	public bool IsPlayTween { get; private set; }
	/// <summary>
	/// Ctrl脚本路径
	/// <summary>
	public string ScriptCtrl { get; private set; }
	/// <summary>
	/// view脚本ID
	/// <summary>
	public int LuaObjId { get; private set; }

	public Table_UICfgItem(ExcelLineReader reader)
	{
		Id = reader.ReadInt();
		Path = reader.ReadString();
		UIType = reader.ReadInt();
		PanelNum = reader.ReadInt();
		ReId = reader.ReadInt();
		Destroy = reader.ReadBool();
		DestroyUnload = reader.ReadBool();
		IsBackClose = reader.ReadBool();
		CameraMovieId = reader.ReadInt();
		Layer = reader.ReadInt();
		IsShowBg = reader.ReadInt();
		SceneBgName = reader.ReadString();
		LockType = reader.ReadInt();
		Show3D = reader.ReadInt();
		OpenGuideId = reader.ReadInt();
		ErrorId = reader.ReadInt();
		FuncSwitchId = reader.ReadInt();
		IsPlayTween = reader.ReadBool();
		ScriptCtrl = reader.ReadString();
		LuaObjId = reader.ReadInt();
	}
}

public class Table_UICfgMgr : IDataMgr
{
	protected override string FileName { get { return "Txt/UICfg.txt"; } }

	protected Dictionary<int, int> mItemDic = new Dictionary<int, int>();
	public int GetIdxById(int key) { return mItemDic[key]; }

	public override void Load(ExcelLineReader reader)
	{
		var item = new Table_UICfgItem(reader);
		mItemDic[item.Id] = DataCount;
		mItemList.Add(item);
	}

	public Table_UICfgItem GetItemByIdx(int idx)
	{
		return GetItemByIdx<Table_UICfgItem>(idx);
	}

	public Table_UICfgItem GetItemById(int id)
	{
		int idx = GetIdxById(id);
		return GetItemByIdx(idx);
	}
}